package com.yztc.yidoutang.http;

import com.yztc.yidoutang.bean.DaRenBean;
import com.yztc.yidoutang.bean.DanPinBean;
import com.yztc.yidoutang.bean.HotSearchBean;
import com.yztc.yidoutang.bean.QuanWuBean;
import com.yztc.yidoutang.bean.QuanWuListBean;
import com.yztc.yidoutang.bean.TuPianBean;

import java.util.Map;

import rx.Scheduler;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by My on 2016/10/18.
 */

public class SouSuoDAO {

    public static void getHotSearchData(Subscriber<HotSearchBean> subscriber){
        getService().getHotSearchBean().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(subscriber);
    }

    public static void getSearchPicData(Map<String, String> params, Subscriber<TuPianBean> subscriber){
        getService().getTuPianBean(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(subscriber);
    }
    private static RetrofitService getService(){
        return HttpHelper.getInstance().getRetrofit().create(RetrofitService.class);
    }

    public static void getSearchQWBean(Map<String, String> params, Subscriber<QuanWuBean> subscriber){
        getService().getQWBean(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(subscriber);
    }

    public static void getSearchDRBean(Map<String, String> params, Subscriber<DaRenBean> subscriber){
        getService().getDRBean(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(subscriber);
    }

    public static  void getSearchDPBean(String querywords, Subscriber<DanPinBean> subscriber){
        getService().getDPBean(querywords).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(subscriber);
    }
}
